package lunadevs.luna.module.exploits;

import org.lwjgl.input.Keyboard;

import com.zCore.Core.zCore;

import lunadevs.luna.category.Category;
import lunadevs.luna.main.Luna;
import lunadevs.luna.module.Module;
import net.minecraft.client.Minecraft;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.world.WorldSettings.GameType;

public class Regen extends Module {

	public Regen() {
		super("Regen", Keyboard.KEY_NONE, Category.EXPLOITS, true);
	}

	@Override
	public void onUpdate() {
		if (!this.isEnabled)
			return;
	    if ((!mc.thePlayer.capabilities.isCreativeMode) && (mc.thePlayer.getFoodStats().getFoodLevel() > 17) && (mc.thePlayer.getHealth() < 20.0F) && (mc.thePlayer.getHealth() != 0.0F) && (mc.thePlayer.onGround)) {
	        for (int i = 0; i < 50; i++) {
	          mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer());
	          zCore.mc().playerController.setGameType(GameType.CREATIVE);
	          zCore.mc().playerController.setGameType(GameType.SURVIVAL);
	        }
	      }
	    }

	
	@Override
	public void onEnable() {
	}
	@Override
	public void onDisable() {
		zCore.mc().playerController.setGameType(GameType.SURVIVAL);
		super.onDisable();
	}

	@Override
	public String getValue() {
		return null;
	}

}
